<?php


abstract class BaseFuntCaso extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $funt_caso_id;


	
	protected $funm_nino_id;


	
	protected $funcas_observacion;


	
	protected $funcas_codigo;

	
	protected $aFunmNino;

	
	protected $collFunrPersonarels;

	
	protected $lastFunrPersonarelCriteria = null;

	
	protected $collFuntFichapsicos;

	
	protected $lastFuntFichapsicoCriteria = null;

	
	protected $collFuntFichasocials;

	
	protected $lastFuntFichasocialCriteria = null;

	
	protected $collFuntNinosxcasos;

	
	protected $lastFuntNinosxcasoCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getFuntCasoId()
	{

		return $this->funt_caso_id;
	}

	
	public function getFunmNinoId()
	{

		return $this->funm_nino_id;
	}

	
	public function getFuncasObservacion()
	{

		return $this->funcas_observacion;
	}

	
	public function getFuncasCodigo()
	{

		return $this->funcas_codigo;
	}

	
	public function setFuntCasoId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->funt_caso_id !== $v) {
			$this->funt_caso_id = $v;
			$this->modifiedColumns[] = FuntCasoPeer::FUNT_CASO_ID;
		}

	} 
	
	public function setFunmNinoId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->funm_nino_id !== $v) {
			$this->funm_nino_id = $v;
			$this->modifiedColumns[] = FuntCasoPeer::FUNM_NINO_ID;
		}

		if ($this->aFunmNino !== null && $this->aFunmNino->getFunmNinoId() !== $v) {
			$this->aFunmNino = null;
		}

	} 
	
	public function setFuncasObservacion($v)
	{

								if ($v instanceof Lob && $v === $this->funcas_observacion) {
			$changed = $v->isModified();
		} else {
			$changed = ($this->funcas_observacion !== $v);
		}
		if ($changed) {
			if ( !($v instanceof Lob) ) {
				$obj = new Clob();
				$obj->setContents($v);
			} else {
				$obj = $v;
			}
			$this->funcas_observacion = $obj;
			$this->modifiedColumns[] = FuntCasoPeer::FUNCAS_OBSERVACION;
		}

	} 
	
	public function setFuncasCodigo($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->funcas_codigo !== $v) {
			$this->funcas_codigo = $v;
			$this->modifiedColumns[] = FuntCasoPeer::FUNCAS_CODIGO;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->funt_caso_id = $rs->getInt($startcol + 0);

			$this->funm_nino_id = $rs->getInt($startcol + 1);

			$this->funcas_observacion = $rs->getBlob($startcol + 2);

			$this->funcas_codigo = $rs->getString($startcol + 3);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 4; 
		} catch (Exception $e) {
			throw new PropelException("Error populating FuntCaso object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(FuntCasoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			FuntCasoPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(FuntCasoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aFunmNino !== null) {
				if ($this->aFunmNino->isModified()) {
					$affectedRows += $this->aFunmNino->save($con);
				}
				$this->setFunmNino($this->aFunmNino);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = FuntCasoPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setFuntCasoId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += FuntCasoPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collFunrPersonarels !== null) {
				foreach($this->collFunrPersonarels as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collFuntFichapsicos !== null) {
				foreach($this->collFuntFichapsicos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collFuntFichasocials !== null) {
				foreach($this->collFuntFichasocials as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collFuntNinosxcasos !== null) {
				foreach($this->collFuntNinosxcasos as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aFunmNino !== null) {
				if (!$this->aFunmNino->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aFunmNino->getValidationFailures());
				}
			}


			if (($retval = FuntCasoPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collFunrPersonarels !== null) {
					foreach($this->collFunrPersonarels as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collFuntFichapsicos !== null) {
					foreach($this->collFuntFichapsicos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collFuntFichasocials !== null) {
					foreach($this->collFuntFichasocials as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collFuntNinosxcasos !== null) {
					foreach($this->collFuntNinosxcasos as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = FuntCasoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getFuntCasoId();
				break;
			case 1:
				return $this->getFunmNinoId();
				break;
			case 2:
				return $this->getFuncasObservacion();
				break;
			case 3:
				return $this->getFuncasCodigo();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = FuntCasoPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getFuntCasoId(),
			$keys[1] => $this->getFunmNinoId(),
			$keys[2] => $this->getFuncasObservacion(),
			$keys[3] => $this->getFuncasCodigo(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = FuntCasoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setFuntCasoId($value);
				break;
			case 1:
				$this->setFunmNinoId($value);
				break;
			case 2:
				$this->setFuncasObservacion($value);
				break;
			case 3:
				$this->setFuncasCodigo($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = FuntCasoPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setFuntCasoId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setFunmNinoId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setFuncasObservacion($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setFuncasCodigo($arr[$keys[3]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(FuntCasoPeer::DATABASE_NAME);

		if ($this->isColumnModified(FuntCasoPeer::FUNT_CASO_ID)) $criteria->add(FuntCasoPeer::FUNT_CASO_ID, $this->funt_caso_id);
		if ($this->isColumnModified(FuntCasoPeer::FUNM_NINO_ID)) $criteria->add(FuntCasoPeer::FUNM_NINO_ID, $this->funm_nino_id);
		if ($this->isColumnModified(FuntCasoPeer::FUNCAS_OBSERVACION)) $criteria->add(FuntCasoPeer::FUNCAS_OBSERVACION, $this->funcas_observacion);
		if ($this->isColumnModified(FuntCasoPeer::FUNCAS_CODIGO)) $criteria->add(FuntCasoPeer::FUNCAS_CODIGO, $this->funcas_codigo);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(FuntCasoPeer::DATABASE_NAME);

		$criteria->add(FuntCasoPeer::FUNT_CASO_ID, $this->funt_caso_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getFuntCasoId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setFuntCasoId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setFunmNinoId($this->funm_nino_id);

		$copyObj->setFuncasObservacion($this->funcas_observacion);

		$copyObj->setFuncasCodigo($this->funcas_codigo);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getFunrPersonarels() as $relObj) {
				$copyObj->addFunrPersonarel($relObj->copy($deepCopy));
			}

			foreach($this->getFuntFichapsicos() as $relObj) {
				$copyObj->addFuntFichapsico($relObj->copy($deepCopy));
			}

			foreach($this->getFuntFichasocials() as $relObj) {
				$copyObj->addFuntFichasocial($relObj->copy($deepCopy));
			}

			foreach($this->getFuntNinosxcasos() as $relObj) {
				$copyObj->addFuntNinosxcaso($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setFuntCasoId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new FuntCasoPeer();
		}
		return self::$peer;
	}

	
	public function setFunmNino($v)
	{


		if ($v === null) {
			$this->setFunmNinoId(NULL);
		} else {
			$this->setFunmNinoId($v->getFunmNinoId());
		}


		$this->aFunmNino = $v;
	}


	
	public function getFunmNino($con = null)
	{
		if ($this->aFunmNino === null && ($this->funm_nino_id !== null)) {
						include_once 'lib/model/om/BaseFunmNinoPeer.php';

			$this->aFunmNino = FunmNinoPeer::retrieveByPK($this->funm_nino_id, $con);

			
		}
		return $this->aFunmNino;
	}

	
	public function initFunrPersonarels()
	{
		if ($this->collFunrPersonarels === null) {
			$this->collFunrPersonarels = array();
		}
	}

	
	public function getFunrPersonarels($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFunrPersonarelPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFunrPersonarels === null) {
			if ($this->isNew()) {
			   $this->collFunrPersonarels = array();
			} else {

				$criteria->add(FunrPersonarelPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FunrPersonarelPeer::addSelectColumns($criteria);
				$this->collFunrPersonarels = FunrPersonarelPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FunrPersonarelPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FunrPersonarelPeer::addSelectColumns($criteria);
				if (!isset($this->lastFunrPersonarelCriteria) || !$this->lastFunrPersonarelCriteria->equals($criteria)) {
					$this->collFunrPersonarels = FunrPersonarelPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFunrPersonarelCriteria = $criteria;
		return $this->collFunrPersonarels;
	}

	
	public function countFunrPersonarels($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFunrPersonarelPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FunrPersonarelPeer::FUNT_CASO_ID, $this->getFuntCasoId());

		return FunrPersonarelPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFunrPersonarel(FunrPersonarel $l)
	{
		$this->collFunrPersonarels[] = $l;
		$l->setFuntCaso($this);
	}


	
	public function getFunrPersonarelsJoinFunrTiporelacion($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFunrPersonarelPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFunrPersonarels === null) {
			if ($this->isNew()) {
				$this->collFunrPersonarels = array();
			} else {

				$criteria->add(FunrPersonarelPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				$this->collFunrPersonarels = FunrPersonarelPeer::doSelectJoinFunrTiporelacion($criteria, $con);
			}
		} else {
									
			$criteria->add(FunrPersonarelPeer::FUNT_CASO_ID, $this->getFuntCasoId());

			if (!isset($this->lastFunrPersonarelCriteria) || !$this->lastFunrPersonarelCriteria->equals($criteria)) {
				$this->collFunrPersonarels = FunrPersonarelPeer::doSelectJoinFunrTiporelacion($criteria, $con);
			}
		}
		$this->lastFunrPersonarelCriteria = $criteria;

		return $this->collFunrPersonarels;
	}

	
	public function initFuntFichapsicos()
	{
		if ($this->collFuntFichapsicos === null) {
			$this->collFuntFichapsicos = array();
		}
	}

	
	public function getFuntFichapsicos($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichapsicoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntFichapsicos === null) {
			if ($this->isNew()) {
			   $this->collFuntFichapsicos = array();
			} else {

				$criteria->add(FuntFichapsicoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntFichapsicoPeer::addSelectColumns($criteria);
				$this->collFuntFichapsicos = FuntFichapsicoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FuntFichapsicoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntFichapsicoPeer::addSelectColumns($criteria);
				if (!isset($this->lastFuntFichapsicoCriteria) || !$this->lastFuntFichapsicoCriteria->equals($criteria)) {
					$this->collFuntFichapsicos = FuntFichapsicoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFuntFichapsicoCriteria = $criteria;
		return $this->collFuntFichapsicos;
	}

	
	public function countFuntFichapsicos($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichapsicoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FuntFichapsicoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

		return FuntFichapsicoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFuntFichapsico(FuntFichapsico $l)
	{
		$this->collFuntFichapsicos[] = $l;
		$l->setFuntCaso($this);
	}


	
	public function getFuntFichapsicosJoinFunrProfesional($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichapsicoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntFichapsicos === null) {
			if ($this->isNew()) {
				$this->collFuntFichapsicos = array();
			} else {

				$criteria->add(FuntFichapsicoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				$this->collFuntFichapsicos = FuntFichapsicoPeer::doSelectJoinFunrProfesional($criteria, $con);
			}
		} else {
									
			$criteria->add(FuntFichapsicoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

			if (!isset($this->lastFuntFichapsicoCriteria) || !$this->lastFuntFichapsicoCriteria->equals($criteria)) {
				$this->collFuntFichapsicos = FuntFichapsicoPeer::doSelectJoinFunrProfesional($criteria, $con);
			}
		}
		$this->lastFuntFichapsicoCriteria = $criteria;

		return $this->collFuntFichapsicos;
	}

	
	public function initFuntFichasocials()
	{
		if ($this->collFuntFichasocials === null) {
			$this->collFuntFichasocials = array();
		}
	}

	
	public function getFuntFichasocials($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichasocialPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntFichasocials === null) {
			if ($this->isNew()) {
			   $this->collFuntFichasocials = array();
			} else {

				$criteria->add(FuntFichasocialPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntFichasocialPeer::addSelectColumns($criteria);
				$this->collFuntFichasocials = FuntFichasocialPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FuntFichasocialPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntFichasocialPeer::addSelectColumns($criteria);
				if (!isset($this->lastFuntFichasocialCriteria) || !$this->lastFuntFichasocialCriteria->equals($criteria)) {
					$this->collFuntFichasocials = FuntFichasocialPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFuntFichasocialCriteria = $criteria;
		return $this->collFuntFichasocials;
	}

	
	public function countFuntFichasocials($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichasocialPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FuntFichasocialPeer::FUNT_CASO_ID, $this->getFuntCasoId());

		return FuntFichasocialPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFuntFichasocial(FuntFichasocial $l)
	{
		$this->collFuntFichasocials[] = $l;
		$l->setFuntCaso($this);
	}


	
	public function getFuntFichasocialsJoinFunrProfesional($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntFichasocialPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntFichasocials === null) {
			if ($this->isNew()) {
				$this->collFuntFichasocials = array();
			} else {

				$criteria->add(FuntFichasocialPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				$this->collFuntFichasocials = FuntFichasocialPeer::doSelectJoinFunrProfesional($criteria, $con);
			}
		} else {
									
			$criteria->add(FuntFichasocialPeer::FUNT_CASO_ID, $this->getFuntCasoId());

			if (!isset($this->lastFuntFichasocialCriteria) || !$this->lastFuntFichasocialCriteria->equals($criteria)) {
				$this->collFuntFichasocials = FuntFichasocialPeer::doSelectJoinFunrProfesional($criteria, $con);
			}
		}
		$this->lastFuntFichasocialCriteria = $criteria;

		return $this->collFuntFichasocials;
	}

	
	public function initFuntNinosxcasos()
	{
		if ($this->collFuntNinosxcasos === null) {
			$this->collFuntNinosxcasos = array();
		}
	}

	
	public function getFuntNinosxcasos($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntNinosxcasos === null) {
			if ($this->isNew()) {
			   $this->collFuntNinosxcasos = array();
			} else {

				$criteria->add(FuntNinosxcasoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntNinosxcasoPeer::addSelectColumns($criteria);
				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(FuntNinosxcasoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				FuntNinosxcasoPeer::addSelectColumns($criteria);
				if (!isset($this->lastFuntNinosxcasoCriteria) || !$this->lastFuntNinosxcasoCriteria->equals($criteria)) {
					$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastFuntNinosxcasoCriteria = $criteria;
		return $this->collFuntNinosxcasos;
	}

	
	public function countFuntNinosxcasos($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(FuntNinosxcasoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

		return FuntNinosxcasoPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addFuntNinosxcaso(FuntNinosxcaso $l)
	{
		$this->collFuntNinosxcasos[] = $l;
		$l->setFuntCaso($this);
	}


	
	public function getFuntNinosxcasosJoinFunmNino($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseFuntNinosxcasoPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collFuntNinosxcasos === null) {
			if ($this->isNew()) {
				$this->collFuntNinosxcasos = array();
			} else {

				$criteria->add(FuntNinosxcasoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelectJoinFunmNino($criteria, $con);
			}
		} else {
									
			$criteria->add(FuntNinosxcasoPeer::FUNT_CASO_ID, $this->getFuntCasoId());

			if (!isset($this->lastFuntNinosxcasoCriteria) || !$this->lastFuntNinosxcasoCriteria->equals($criteria)) {
				$this->collFuntNinosxcasos = FuntNinosxcasoPeer::doSelectJoinFunmNino($criteria, $con);
			}
		}
		$this->lastFuntNinosxcasoCriteria = $criteria;

		return $this->collFuntNinosxcasos;
	}

} 